<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title>

<%@ page
	import="universal.schema.action.*,java.util.*,universal.schema.model.*,com.opensymphony.xwork2.ActionContext"%>

<script type="text/javascript">
	$(function() {
		$("#tabs").tabs({
			selected : 5,
			disabled : [ 0, 1, 2, 3, 4 ]
		});
	});
	
</script>

</head>
<body>
	<div>
		<div id="tabs">
			<ul>
				<li><a href="#tabs-1"><font style="font-size: 20px;">1</font>&nbsp;<font
						style="font-size: 12px">Select Tables</font></a></li>
				<!-- 0 -->
				<li><a href="#tabs-2"><font style="font-size: 20px;">2</font>&nbsp;<font
						style="font-size: 12px">Select Columns</font></a></li>
				<!-- 1 -->
				<li><a href="#tabs-2.5"><font style="font-size: 20px;">3</font>&nbsp;<font
						style="font-size: 12px">Choice</font></a></li>
				<!-- 2 -->
				<li><a href="#tabs-3"><font style="font-size: 20px;">4</font>&nbsp;<font
						style="font-size: 12px">Select Filters</font></a></li>
				<!-- 3 -->
				<li><a href="#tabs-4"><font style="font-size: 20px;">5</font>&nbsp;<font
						style="font-size: 12px">View Query</font></a></li>
				<!-- 4 -->
				<li><a href="#tabs-5"><font
						style="font-size: 20px; color: #FFAD00;">6</font>&nbsp;<font
						style="font-size: 12px">Query Results</font></a></li>
				<!-- 5 -->
			</ul>

			<!-- ================ Welcome tab content================ -->
			<div id="tabs-5">
				<s:if test="step4Res.size()==0">
					<br />
					<br />
					<br />
					<div class="alert alert-info" align="center">

						<button type="button" class="close" data-dismiss="alert"></button>
						<font size="3" color="orange"><b>The query gives zero
								rows as output.</b></font>

					</div>
				</s:if>


				<s:if test="step4Res.size()!=0">
					<br />
					<br />
					<br />
					<div align="center">
						<font size="4"><b>Query Result</b></font> <br /> <br />
					</div>
					<br />

					<!-- display existing items  -->

					<%
						String[] colsList = (String[]) ActionContext.getContext()
									.getSession().get("selectedColumns");
							int val = colsList.length;
							ArrayList<String> result = (ArrayList<String>) request.getAttribute("step4Res");
							System.out.println("result length"+result.size());
							/* out.println(result.size()); */
					%>
					<table class="table table-striped table-bordered">
						<tr>
							<%
								for (int l = 0; l < val; l++) {
							%>
							<th><%=colsList[l].toUpperCase()%></th>
							<%
								}
							%>
						</tr>
						<%
							for (int i = 0; i < result.size(); i = i + val) {
						%>
						<tr>
							<%
								for (int j = i; j < i + val; j++) {
							%>
							<td><%=result.get(j)%></td>
							<%
								}
							%>
						</tr>
						<%
							}
						%>
						<% result.clear();
				if(colsList!=null)
					colsList=null;%>
					</table>

				</s:if>




				<br /> <a href="RestartWork.action" class="btn btn-primary">Run
					Another Query?</a> <br />

			</div>
		</div>
	</div>
</body>
</html>